﻿using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using WindowsGame1.GameMain;
using WindowsGame1.Interface;

namespace WindowsGame1.Windows
{
    public class EndGame : Canvas
    {
        public bool IsVisible { private set; get; }
        private const string StartMessage = "Seu score e: ";
        private string _finalMessage;
        public EndGame()
        {
            IsVisible = false;
        }

        public override void LoadContent(ContentManager content)
        {
            
        }

        public override void Update(GameTime gameTime)
        {
            
        }

        public override void Render(SpriteBatch render)
        {
            if (IsVisible)
            {
                render.DrawString(StaticGUi.Font, "Score:", new Vector2(StaticGUi.Width / 2 - 50, 0), Color.White);
                render.DrawString(StaticGUi.LittleFont, _finalMessage, new Vector2(StaticGUi.Width / 2 - 100, StaticGUi.Height / 2 - 25), Color.White);
            }
        }

        public void Visible(bool visible)
        {
            IsVisible = visible;

            if (IsVisible)
                _finalMessage = StartMessage + StaticGUi.Time.RunningTime;
        }
    }
}
